home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C++ / Applications / Lookup 1.0d2 / Sources / CChangeEntryAction.cp < prev    next >
Encoding:
Text File  |  1995-09-12  |  1.3 KB  |  52 lines  |  [TEXT/CWIE]

  1. /*
  2.     CChangeEntryAction.cp
  3.  
  4.     Copyright © 1995 Alastair Rankine.
  5.     All Rights Reserved.
  6. */
  7.  
  8. #include "CChangeEntryAction.h"
  9. #include "CEntryList.h"
  10. #include "CLookupDocument.h"
  11. #include "ResourceIDs.h"
  12. #include <UAEGizmos.h>
  13.  
  14. CChangeEntryAction::CChangeEntryAction(CLookupDocument & inLookupDocument, UInt16 inRow,
  15.     const CEntry & inNewData)
  16.     : LAEAction(STRx_RedoEdit, str_RedoChange)
  17. {
  18.     LAEStream redo(kAECoreSuite, kAESetData);
  19.     LAEStream undo(kAECoreSuite, kAESetData);
  20.  
  21.     //    keyDirectObject - the record to change.
  22.     const CEntry & changeEntry = inLookupDocument.GetEntryAt(inRow);
  23.     redo.WriteKey(keyDirectObject);
  24.     redo.WriteSpecifier(&changeEntry);
  25.     undo.WriteKey(keyDirectObject);
  26.     undo.WriteSpecifier(&changeEntry);
  27.     
  28.     //    keyAEData - a record with the change info:
  29.     StAEDescriptor newProps;
  30.     inNewData.GetDifferentAEProperties(changeEntry, newProps.mDesc);
  31.     redo.WriteKeyDesc(keyAEData, newProps.mDesc);
  32.  
  33.     StAEDescriptor oldProps;
  34.     changeEntry.GetDifferentAEProperties(inNewData, oldProps.mDesc);
  35.     undo.WriteKeyDesc(keyAEData, oldProps.mDesc);
  36.  
  37.     // Close the stream, and assign the AE to the Redo event.
  38.     StAEDescriptor redoEvent;
  39.     redo.Close(&redoEvent.mDesc);
  40.     SetRedoAE(redoEvent.mDesc);
  41.  
  42.     // Close the stream, and assign the AE to the Redo event.
  43.     StAEDescriptor undoEvent;
  44.     redo.Close(&undoEvent.mDesc);
  45.     SetUndoAE(undoEvent.mDesc);
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.